extends "../i_bangleh/i_bangleh.gd"
var flag 
func init():
	.init()
	name = "火手镯·噬"
	resetdata()
	info = "火焰反噬：被攻击时,33%使攻击者附加一层<火种>和免疫所有和火有关的buff[免疫持续4秒，cd：6秒]；<火种>爆发额外增加10%物攻\n" + info

func _connect():
	._connect()
	masCha.connect("onHurt",self,"addbing")
	masCha.connect("onBattleStart",self,"resetflag")

func resetflag():
	flag = 1

func _upS():
	._upS()
	if flag:return
	cnt2 += 1
	if cnt2 == 6:
		cnt2 = 0
		flag = 1

func addbing(atkinfo):
	if atkinfo.isMiss || atkinfo.atkType == Chara.AtkType.EFF:return
	if sys.rndPer(33):
		var lf = 3
		if masCha.hasBuff("HY"):lf = 6
		var bf = atkinfo.atkCha.hasBuff("b_huozhong")
		var exdmg = masCha.att.atk * 0.1
		if !bf:
			var tmp = 0
			for i in huolist:
				var bf2 = atkinfo.hitCha.hasBuff(i)
				if bf2:
					bf2.isDel = true
					tmp = 1
			if tmp:
				masCha.hurtChara(atkinfo.hitCha,atkinfo.hitCha.att.maxHp * 0.05 + exdmg,Chara.HurtType.REAL,Chara.AtkType.EFF)
				return
			atkinfo.hitCha.addBuff(ctrl.b_huozhong.new(lf,1,exdmg,null))
		else:
			bf.life += lf
			bf.cnt += 1
		if flag:
			flag = 0
			masCha.addBuff(MYH.new(1)) 